<template>
	<div class="badgeWhite baseContent" :style="dataRend.style" v-loading="active">
		<basetitle>
			<slot slot="left">{{dataRend.name}}</slot>
			<slot slot="right">
        <div style="height: 32px;line-height: 31px;">
          <!--:class="[{rightFontActive : active==true},'rightFontCont']" -->
          <div class="rightFontCont" style="height: 29px">
            <i class="iconfont icon-shuaxin1 rightFont" @click="refreshFull(dataRend.prn)"></i>
          </div>
          <el-input style="width: 210px;" placeholder="请输入关键字" v-if="showInput" v-model.trim="searchContent" @blur="searchSome(dataRend.prn)"></el-input>
          <i style="cursor: pointer;font-size: 18px;color: #999;margin-right: 5px;font-weight: 600;" class="el-icon-search rightFont" @click="showInput=true"></i>
        </div>
        </slot>
		</basetitle>
		<div class="baseCont">
		<div class="chart-container overAuto" v-if="dataRend.itemData"  :style="{ height: dataRend.itemData.height ? dataRend.itemData.height : defalutHeight }">
			<div style="margin-top: 6px;">
        <Table :tableDatas="dataRend.itemData.list" :columns="dataRend.itemData.columns"/>
      </div>
		</div>
		</div>
	</div>
</template>
<script>
 const basetitle =()=>import('@/components/basetitle/index.vue')//
 const Table =()=>import('@/components/Table')//
import {refreshContent,strSearchContent} from "../../../api/config.js"
import store from '../../../store'
import { mapState, mapActions } from 'vuex'
import { getFromCache } from '@/utils/cache.js';
export default {
	name: 'OverdueTask',
	props: {
		defalutHeight: {
			type: String,
			default: '300px'
		},
		itemdata: {
			default: Object
		}
	},
	components: {
		basetitle,
    Table
	},
	data() {
		return {
			dataRend:{},
			active:false,
      showInput:false,
      searchContent:''
		};
	},
	computed: {
		...mapState({
			   mainRend:state => store.state.base.mainRend
		}),
	},
	beforeDestroy() {

	},
	mounted() {
		 this.dataRend=this.itemdata
	},
	methods: {
		...mapActions('base', ['getIndexRend']),
		refreshFull(type){
			let that=this;
			that.active=true;
			let parms={};
			parms.type=type;
      parms.user_prn = JSON.parse(getFromCache('userInfo')).env$user_prn;
			that.$post(refreshContent, parms).then(response => {
				setTimeout(function () {
				that.active=false;
				that.showInput=false;
				that.searchContent='';
				},2000);
				that.dataRend=response.obj
			})
		},
    searchSome(prn){
      let parms={};
      parms.platePrn=prn;
      parms.searchStr=this.searchContent;
      parms.user_prn=JSON.parse(getFromCache('userInfo')).env$user_prn;
      this.$post(strSearchContent, parms).then(response => {
        this.dataRend=response.obj
      })
    }
	},
	watch:{

	}
};
</script>

<style>
  .blueColor{
    color: #1A90FD;
  }
  .redColor{
    color: #F5222D;
  }
</style>
